package com.mjfeed.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.mjfeed.dao.ProductDao;
import com.mjfeed.entity.Product;

@Repository("productDao")
public class ProductDaoImpl extends BaseDaoImpl<Product> implements ProductDao {
	
	public List<Product> getAllProducts() {
		return getAll(Product.class);
	}

	public boolean snExists(String sn) {
		Long count = (Long)getUniqueResultByJpql("from Product product where lower(product.sn) = lower(?)", new Object[]{ sn });
		return (count != null && count > 0) ? true : false;
	}

}
